<?php
namespace app\admin\validate;
use think\Validate;

class Supply extends Validate
{
    protected $rule = [
        'name' => 'require|unique:supply|length:2,50',
        'supply_desc'=>'max:50',
        'url'=>'require|max:255',
        'app_id'=>'require|max:50',
        'app_key'=>'require|max:50',
        'regname'=>'require|max:50',
        'contacts' => 'require|length:2,5',
        'telephone' => 'require|regex:/^1[3456789]\d{9}$/',
        'fenxiao'=>'require|in:0,1',
        'status'=>'require|in:0,1',
    ];

    protected $message = [
        'name.require' => '供应链名称不能为空',
        'name.unique' => '供应链名称已存在',
        'name.length' => '供应链名称只能为2到50个字符',
        'supply_desc.max' => '供应链描述最多50个字符',
        'url.require' => '接口地址不能为空',
        'url.max' => '接口地址最多255个字符',
        'app_id.require' => 'app_id不能为空',
        'app_id.max' => 'app_id最多50个字符',
        'app_key.require' => 'app_key不能为空',
        'app_key.max' => 'app_key最多50个字符',
        'telephone.require' => '手机号不能为空',
        'telephone.regex' => '手机号格式不正确',
        'fenxiao.require' => '请选择是否开启商品分销',
        'fenxiao.in' => '请选择是否开启商品分销',
        'status.require' => '请选择是否启用供应链',
        'status.in' => '请选择是否启用供应链',

    ];
    

}